import numpy as np

def armijo(x0,d,g,func,rho,sigma,m,maxm):
    if m >= maxm or func(x0 + (rho**m)*d) < func(x0)+ (sigma*(rho**m)*(np.dot(g.reshape(len(g),-1),d.reshape(-1,len(d))))[0][0]):
        return (rho**m)*d
    else:
        return armijo(x0,d,g,func,rho,sigma,m + 1,maxm)

